package com.hao.wms.query;

public class ProductQueryObject extends QueryObject {
    private String keyword;
    private Long brandId = -1L;

    public String getKeyword() {
        return keyword;
    }

    public void setKeyword(String keyword) {
        this.keyword = keyword;
    }

    public Long getBrandId() {
        return brandId;
    }

    public void setBrandId(Long brandId) {
        this.brandId = brandId;
    }

    @Override
    public void customerQuery() {
        if (hasLength(keyword)) {
            String key = "%" + keyword + "%";
            addQuery("obj.name like ? or obj.sn like ?", key, key);
        }
        if (brandId > 0) {
            addQuery("obj.brand.id = ?", brandId);
        }
    }

}
